<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="renderer" content="webkit">
<title></title>
<link rel="stylesheet" href="css/pintuer.css">
<link rel="stylesheet" href="css/admin.css">
<script src="js/jquery-2.1.0.js"></script>
<script src="js/pintuer.js"></script>
</head>
<body>
<div class="panel admin-panel margin-top">
  <div class="panel-head" id="add"><strong><span class="icon-pencil-square-o"></span>课程修改</strong></div>
  <div class="body-content">
    <form  class="form-x" >        
      <div class="form-group">
        <div class="label">
          <label>课程名称：</label>
        </div>
        <div class="field">
          <input  id="icoursename"  type="text" class="input w50" name="title" value="" />
          <div class="tips"></div>
        </div>
      </div>        
      <div class="form-group">
        <div class="label">
          <label>课程简介：</label>
        </div>
        <div class="field">
            <textarea  id="icourseintro" type="text" class="input w50" name="tits" style="height:150px;" placeholder="请描述该课程"></textarea>      
        </div>
      </div>
      
      <div class="form-group">
        <div class="label">
          <label></label>
        </div>
          <div class="field">
          	 <input  class="button bg-main icon-check-square-o"  style="text-align: center;"  type="button" name="back" value="确定提交" onclick="modify()"/>
        </div>
      </div>
    </form>
  </div>
</div>
</body>

   <script type="text/javascript">
   	
   	
       function  modify(){
   		 val = {
		 	  "courseid":	window.location.href.split("=")[1],
		 	  "coursename": $('#icoursename').val(),
				"courseintro": $('#icourseintro').val(),
			  };
		 	
      var url = 'http://119.3.13.186:8080/ZDEduBooking/servlet/UpdateCourseServlet';
      $.ajax( {
      	url: url,
      	type: 'POST',
        data: {
						DATA: JSON.stringify(val)
			  },
        dataType: 'json',
        crossDomain: true,
        success: function(data) {
                if(data.result=='0')
               {
                     history.back(-1);
               }
               else{
                  	alert("修改课程失败");
               }
        },
						error: function(xhr, type, errorThrown) {
							   alert("服务器异常，请稍后再试:" + type);
						}
					});
					
   	};
   	
		 
</script>

 


</html>